<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script>
    // 使用ES6的class语法创建Person类
class Person {
    constructor(name, age) {
        this.name = name;
        this.age = age;
    }
    run() {
        console.log(`${this.name} is running.`);
    }
}// 创建Teacher类，并继承Person类
class Teacher extends Person {
    constructor(name, age, addr) {// 调用super方法以执行Person的constructor
        super(name, age); // 添加Teacher特有的属性
        this.addr = addr;
    }
}// 创建一个Teacher对象t1
const t1 = new Teacher('John Doe', 30, '123 Main Street');// 让t1执行Person的方法run
t1.run(); // 输出：John Doe is running.
console.log(t1.addr); // 输出：123 Main Street
</script>
</head>
</html>
